The top of the head answer is that acceptable plants have a set of chemicals in common that makes them attractive or - more likely - that the not acceptable plants have chemicals in them that lead to avoidance. If these chemicals show up in different families but not in all members of these families - you would get the described effect. I would suggest you read the book Host-plant selection by phytophagous insects by Bernays and Chapman. It is from 1994 but it should give you all the basics.