You have to match gems near or on the butterflies to rescue them, if any reach the top the game is over. Try and match 4 or more to create special gems, these will help cause chains and explosions that free multiple butterflies in one move.
Also try and make horizontal matches rather than vertical, this will help knock down butterflies that are nearing the top rows.