It's a mix of rankings, requests and organizer's knowledge. It a team, by the rankings, is put in group B but there are teams in Group C that beat them handily, then they'll make an adjustment, and stuff like that.
Personally I don't like the way tournaments are run here. I prefer the group stage (shortened) games where you have to play your way into the top groups, especially in tournaments with teams from various areas who don't normally play one another that often.