Conditional matches in sets of 3-tuples
If I understood you correctly, something like this would work
Cases[data,{{_,a_,b_},{a_,b_,c_},{b_,c_,_}}]
(* {{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
{{0, 1, 0}, {1, 0, 1}, {0, 1, 1}},
{{1, 0, 1}, {0, 1, 1}, {1, 1, 1}}} *)
Select[Most[Rest /@ #] == Rest[Most /@ #] &] @ data
{{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 1, 0}, {1, 0, 1}, {0, 1, 1}}, {{1, 0, 1}, {0, 1, 1}, {1, 1, 1}}}
Pick[
data,
MapThread[SameQ, {
data[[All, ;; -2, {2, 3}]],
data[[All, 2 ;;, {1, 2}]]
}]
]
(* Out: {{{0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, {{0, 1, 0}, {1, 0, 1}, {0, 1,
1}}, {{1, 0, 1}, {0, 1, 1}, {1, 1, 1}}} *)