Coordination polymers (CPs) and metal-organic frameworks (MOFs) have emerged as versatile precursors for transition-metal phosphides catalysts. However, the controlled synthesis of MOF-derived bimetallic phosphides remains a challenge, as mixtures of various phosphide phases are often formed. Here, it is shown that controlling the formation of pure CoMoP and CoMoP2 requires a careful choice of the ligands used to construct the MOF precursors, based on the chemical properties of the metals. In particular, the nature and number of the coordination moieties of the ligand play a key role. CoMoP and CoMoP2 particles coated with N-doped carbon were derived from phosphonate-based MOFs and compared as hydrogen evolution reaction (HER) electrocatalysts in acidic medium. CoMoP2 is more active and shows a turnover frequency (TOF) of 0.9 s-1 compared to 0.4 s-1 for CoMoP. The higher intrinsic activity of the CoMoP2 catalytic sites correlates with the differences in the electronic structure of the materials, with a larger charge transfer from the molybdenum to the phosphorous found for CoMoP2.