Well, you have to take chain and more-than-3 elimination into account. The premise is simple, but execution - especially smooth and failproof - can be a little tricky.
It can be done with simple condition checking (if a bit slower than array):
For each block on the field, check if it has any neighboring blocks of the same color. If it finds one, check that block's next neighbor - that is in the same direction. If there is one, mark for demolition. Do this for EACH block on the field.
Then, once checks are done, start the demolition. Whee! Fireworks! After that, collapse the pieces or whatever and repeat the check, until there are no blocks that meet the condition, then allow the player's input.
This method has the advantage of streamlining; you can use fancy animations and stuff!
+For each block
- Are any of its four neighbors of the same color?
- Check that block's adjacent block, that is in the same direction
> Mark these blocks for demolition
When done checking all blocks, DEMOLISH! Then re-check all blocks until NONE are marked for demolition and wait for player's move.