Ahh... I see what you mean. Hard to explain, but you "walk" the grid from each direction-- N S E & W and count how many items are the same. if you get to three, then you mark all of them to be deleted.
Maybe read this... https://gamedev.stackexchange.com/questions/2607/match-three-puzzle-games-algori...