If I understand 5E Grapple correctly, that might not stop the casting of the spell. Establishing a Grapple is kinda like getting one hand one someone's shoulder, or grabbing them by the front of their shirt. The target isn't going anywhere, can't run away; but the target is not yet Restrained. It takes a follow-up action to Shove or to Restrain, after initially establishing the grapple.
I'd argue that there's some spells one could cast even when fully Restrained. A restrained person can still attack, just with disadvantage. It is common for judo duellists to tap the mat, to surrender. If a judoka decides that they've been successfully pinned, and is ready to call that round a loss; and still has the ability to tap out; then a person might be Restrained, and still be able to perform Somatic and Verbal components. Perhaps with a stat check, at DM discretion?
As far as the grappling, we've tweaked the grappling rules quite a bit, but as written all they do is drop your speed to 0. So as written you would have to incapacitate the spellcaster with your readied attack in order to prevent the spell from being cast.
Yes, any spell with only a verbal component could be cast when restrained. For somatic components I'd probably argue not. Part of the discussion we've had, and why we've landed where we have, is: "how could you capture or imprison a spellcaster?" Traditionally it involves binding their hands and gagging them.
Burning hands, since it has a specific description, is a good example. It doesn't specify that it's the only somatic component, and even when shackled you could probably put your thumbs together and spread your fingers as described (and pictured). But based on the restrained rule, it would not be possible.
So if you can't cast a spell when bound, then I think you need a little more freedom of movement to cast it. This would apply to being restrained as well in my mind. Note that according to how the rules are written (and clarified recently online), you only need ONE hand free. Which goes directly against the
burning hands description.
In the end, for simplicity we've gone with Restrained=no spells with somatic components.
Grappling on the other hand, that's a good question. I was thinking more in terms that the guard would either grab their arms or tackle them. Assuming you wanted to somebody a chance to stop the spellcasting, then if they were grappled they would at least need to make a check to cast the spell. I would suggest either a saving throw (Dex, probably) or a Concentration check. If the spell has an attack roll it could be at disadvantage. Otherwise, at this point it requires incapacitation to prevent the spell from being cast.
The situation hasn't come up, and I'm OK with either option myself.
Ilbranteloth