You have to form towers of pills of the same color. For this you move pills over other of the same color, and then the formed pile over other of the same color, but never pass over other of different color or you'll be lost.
Move the mouse to move the pill or the current tower of pills. You earn more points with bigger towers, but if they touch a pill of a different color you lose all points. To avoid it, you can always consider that the current tower is finished and sum its points: it's enough to click on it to do it.