It's decided via computer after the draw. Each group member is given a position in the group (1-4), which is the order u'll see the group members in every time u see them written down. That decides in which order the matches are played and which team is 'home' in which match.