Similar Items: Decidable Classes of Tree Automata Mixing Local and Global Constraints Modulo Flat Theories