It is so tough to know! To be honest if it was JUST some greenish poops I might let it be. But if you say he is having some mucus in there you might have to cut out dairy.

I still had problems with Matthew having some mucus even after I cut out the dairy, so I think he may have a couple things that bother him. He also had problems with reflux and just tummy issues in general though.
Green poop can also be a sign of a virus, but it should go away if it's a virus.
Matthew didn't have a lot of green poop (it was occassional), but he did have mucusy poops and also here's a biggie: Have them check his poop for occult (hidden) blood. If there's blood in there, that's a good sign he is having trouble with dairy, or something else. I read that the VAST majority of the time, if they have trouble, dairy is the culprit. Matthew had blood in there (hidden) for a bit and then it went away and has stayed away, even when I've tried dairy. Now dairy gives him diarrhea and mucus in his poop and diaper rash, but he can tolerate it through breastmilk now.
As for what to eat, it was really hard for me. If I had to go back and do it again I might cut out the major dairy but leave in the trace stuff (like small amounts in pre packaged baked goods). Whole Foods has dairy free butter substitute (I think it's made by Earth Balance) and maybe Trader Joes has it as well. You can try soy products, but be aware that I think 50% of babies who have issues with dairy, will have problems with soy as well. I drank Hemp milk, or you can do rice or almond milk. Rice milk does okay as a substitute for when you are cooking, just replace it for the regular milk. Some of the things you can eat with no dairy: eggs, spaghetti, stews (with roast meat, potatoes, carrots), chicken and dumplings, chicken and rice, basically any dish that doesn't have cheese (I know that's tough b/c the cheese makes it yummy!)
It takes many weeks for ALL the dairy to get out of your system, so you if you give it up, it may take awhile for it to take effect. The first time I cut dairy out, i don't think I gave it a long enough try.