To complete the goals and finish the level, you only have a specified amount of moves. Once you accomplish all the goals and collect the number of pieces indicated on the left panel, the level is beaten.
Match three or more pieces of the same type to progress through the levels. You're getting power-ups that help speed things up for matching four or more pieces
There are also various obstacles that make the levels more challenging. In some cases, you'll have to destroy those obstacles. Power-ups and tools will help you get through the levels with fewer moves. Note that you can combine power-ups to produce a greater effect!
Remember, the more moves you have left by the end of the level, the bigger your reward will be!