2 teams with the same points: the match which those two teams played counts. Is that a tie? Then it goes on goal difference.
3 teams with the same points: goal difference from all matches apart from matches played against the team with a different amounts of points.
4 teams with the same points: I don't have a fucking clue. What if all matches in the group stage would be tied? That would be well weird.
Here's the whole set of rules. Eeek.
• (a) higher number of points obtained in the matches among the teams in question
• (b) superior goal difference in the matches among the teams in question
• (c) higher number of goals scored in the matches among the teams in question
• (d) If, after having applied criteria a) to c), two of those teams still have an equal ranking, criteria a) to c) are reapplied exclusively to the matches between the two teams in question to determine the final rankings of the two teams. If this procedure does not lead to a decision, criteria e) to i) apply in the order given
• (e) superior goal difference in all the group matches
• (f) higher number of goals scored in all the group matches
• (g) if the two teams have played each other in the final group game, the team to progress would be decided on penalties. Otherwise it comes down to the Uefa national team coefficient ranking system
• (h) fair play conduct of the teams (final tournament)
• (i) drawing of lots.