baby screams while having a bowel movement?

Clarissa • Mama
My 1month baby is on a formula for a cow's milk allergy. She's happy almost alway except when she poops! She screams until she's purple and can't breathe. Her poos are soft, greenish, but come out as pellets (but they're really soft like playdoh). Any ideas of what it is or what could help?
We already move and bend her legs. I've checked for signs of a rash. There's no blood.
Help!?