One of the easiest ways is to generate the board solved. Generate a board that is all matched pairs, then run it through an algorithm that shuffles it about until some criteria is met (Like no matching triplets left on the board.)
There will always be a solution for a board made this way that can be solved to completion if you control the number/intensity of the shuffling.
Edit: I wrote this thinking it was a match two for some reason. With a match three it is a bit more difficult, and it depends on the way the pieces move after being removed, and if any new pieces are added. With a match 3 it may be more realistic to start with three blocks matched, then add three more matched that possibly break up the first three, and loop and repeat until you have a full board.
Basically play the game in reverse as a function and it should generate solvable boards.