Mechanistic Interpretability of Binary and Ternary Transformers