I've literally carried raids as a SMN and gotten no coms and then done a barely acceptable job as a melee and gotten coms. There's no real logic behind it, don't question it. Sometimes people don't comm at all, too.
I try to comm within my role unless someone does a stellar job. If I'm playing healer or tank and my partner did a good job then I'll always give it to them. Usually I'll give it to the DPS who has good buff alignment when I'm playing DPS, but I'll always comm a dancer if they give me DP or AST if they give me cards.

Edit: Sometimes if everyone was good or bad or average I'll comm whoever has the best portrait.