My 2.5 year old does the same thing and has been doing it for quite a while now. I don't really know what the answer is, but what I do is keep forcing him to eat stuff that he doesn't like and when he throws up I calmly take him upstairs, clean him off, and bring him back to finish the food that he doesn't like. We've taken him to numerous doctors that insist there isn't anything physically wrong with him, so I guess it's just a mental thing with him.