[show abstract][hide abstract] ABSTRACT: We investigate the dynamics of systems of many coupled phase oscillators with heterogeneous frequencies. We suppose that the oscillators occur in M groups. Each oscillator is connected to other oscillators in its group with "attractive" coupling, such that the coupling promotes synchronization within the group. The coupling between oscillators in different groups is "repulsive," i.e., their oscillation phases repel. To address this problem, we reduce the governing equations to a lower-dimensional form via the ansatz of Ott and Antonsen, Chaos 18, 037113 (2008). We first consider the symmetric case where all group parameters are the same, and the attractive and repulsive coupling are also the same for each of the M groups. We find a manifold L of neutrally stable equilibria, and we show that all other equilibria are unstable. For M ≥ 3, L has dimension M - 2, and for M = 2, it has dimension 1. To address the general asymmetric case, we then introduce small deviations from symmetry in the group and coupling parameters. Doing a slow/fast timescale analysis, we obtain slow time evolution equations for the motion of the M groups on the manifold L. We use these equations to study the dynamics of the groups and compare the results with numerical simulations.