Heterogeneous Contrastive Learning for Foundation Models and Beyond