my son(then about 2.5) did it ONCE (spit his food out) at a restaurant. i told him in no uncertain terms that if he did it again, he would be removed immediately from the restaurant. he did it again.
i slid back my chair, picked him up and took him out of the restaurant. once he realised what was happening, he started to cry...i calmly left the restaurant carrying him.
we got about 100' from the entrance and i put him down. i got down to his level and told him how angry i was with his behaviour. that it isn't tolerated. he asked if he could go back to eat, that he wouldn't spit again. i said ok, but he'd have to say sorry to everyone at the table for his behaviour.
we went back into the restaurant, he very sheepishly apologised to everyone and ate his dinner without incident.
that was the first and last time he ever tried it.
you have to make a rule and stick to it. you cannot back down and waffle on it. if you say the behaviour will have consequences, then those consequences MUST follow.
if you tell her/him that if they spit it out again, you will take the food away and there will be nothing until XXX time (snack, dinner, lunch etc)... then YOU must have the backbone to follow through with the threat. NO MATTER how much crying ensues.
(caps for emphasis not denoting screaming at you.)