Hello, Carolina1983.
Alan Cruttenden, in the seventh edition of Gimson’s Pronunciation of English, says:
In addition to the loss of /h/ in pronominal weak forms and other consonantal elisions typical of weak forms (see §11.3), the alveolar plosives are apt to be elided. Such elision appears to take place most readily when /t/ or /d/ is the middle one of three consonants. Any consonant may appear in third position, though elision of the alveolar plosive is relatively rare before /h/ and /j/. Thus elision is common in the sequence voiceless continuant + /t/ or voiced continuant + /d/ (e.g. /-st, -ft, -ʃt, -nd, -ld, -zd, -ðd, -vd/) followed by a word with an initial consonant …
… It will be seen that in many cases, e.g. in I walked back, They seemed glad, elision of word-final /t/ or /d/ eliminates the phonetic cue of past tense, compensation for which is made by the general context. Such is the instability of the alveolar plosives in suck a position of apparent inflexional significance that it can be assumed that the context regularly carries the burden of tense distinction. Where the juxtaposition of words brings together a cluster of consonants (particularly of stops), elision of a plosive medial in three or more is to be expected, since, because of the normal lack of release of a stop in such a situation, the only cue to its presence is likely the be the total duration of closure.
Since I'm just a non-native learner, I can’t say for sure that this applies to “grand castle” and “grand piano”, but at least both seem to meet the above condition, “voiced continuant + /d/ followed by a word with an initial consonant.”