Read the Grappling section.
While grappled, you cannot cast a spell with a somatic component.
You can cast a spell with a Material component... provided you have the component in hand.
Also check Natural Spell from MotW. Somatic components are replaced by paw-waving or wing-waggling... but you still ahve to hold the M component in your beak, or whatever.
-Hyp.