Every time you beat a level you earn 1 star. With each earned star the level gets harder, so the level needs to be played 3 times to reach all stars and unlock bonus levels.