When Can Transformers Ground and Compose: Insights from Compositional Generalization Benchmarks