Create groups of 3 or more of the same block to clear them. Don't let the blocks reach the bottom of the screen. When you have enough points, you'll level up: all free spaces will give you extra points, clearing some of the blocks on the screen.
Mouse:
Click the 2 blocks to swap them, move your mouse to place them, then click (off of the blocks) to launch them.
Keyboard:
Press down to swap the 2 blocks, use left and right to place them, and press up to launch them.