Just as for adults and older children, some babies are just more sensitive to others. It also has to do with how "leaky" the mom's gut is in terms of the amount of proteins and other substances from the food end up in the milk supply. Whoever said food doesn't impact breastmilk is wrong. I've talked to several knowledgeable doctors about this and the mother's diet does impact the breastmilk. Why on earth else would medications and alcohol?
Anyways, dairy is the most common culprit. The others seem to depend upon the mother. My youngest couldn't tolerate me eating any fruit with small seeds or pulp - thus no berries or orange juice. Also, broccoli. I couldn't personally tolerate beans, but those are another common culprit.
Another often hidden issue is the mother's intolerance to gluten (found in wheat, rye, barley and oats). That's often the reason the mother will have a leaky gut.
I will note that if dairy is the culprit, the child may well never be able to tolerate dairy - neither of my kids could and it really doesn't have to do with "growing out of it" as human bodies aren't designed to digest cow's milk.