The point is to destroy all the balls by destroying a group so that the rest will drop.
Consider the following example:
The next ball is not a yellow ball, so you should connect all the non-yellow balls with the yellow ball:
Now that a yellow ball appears, you should connect it with the yellow ball at the top, and shoot other non-yellow balls so that they are connected with the yellow balls:
Now another yellow ball appears, you should connect it with the yellow balls at the top so that they will be destroyed. Then the rest of the balls will drop and all the balls are cleared.