Neutron diffraction was used to determine the crystallographic structures of the ${\mathrm{YFe}}_{10}{\mathrm{Mo}}_{2}$ and ${\mathrm{YFe}}_{10}{\mathrm{Mo}}_{2}X$ $(X$=H,N). The spin-polarized muffin-tin-orbital method was applied to calculate the electronic structures of ${\mathrm{YFe}}_{10}{\mathrm{Mo}}_{2}X$ $(X$=H,B,C,N,O,F) and ${\mathrm{YFe}}_{10}{\mathrm{Mo}}_{2}E$, which is ${\mathrm{YFe}}_{10}{\mathrm{Mo}}_{2}$ with an empty sphere insertion. Both N and H atoms were found to reside on the interstitial $2b$ sites. The magnetovolume effect and chemical bonding effect of interstitial $X$ atoms are investigated by a systematic analysis of the local magnetic moments ${\ensuremath{\mu}}_{\mathrm{loc}},$ Fermi-contact hyperfine fields ${(H}_{\mathrm{FC}})$, and isomer shifts (IS) at different Fe sites in ${\mathrm{YFe}}_{10}{\mathrm{Mo}}_{2}X$ $(X$=H,B,C,N,O,F) and ${\mathrm{YFe}}_{10}{\mathrm{Mo}}_{2}E$. It is found that the insertion of the $X$ atom changes not only Fe-Fe interaction, but also Fe-$X$ interaction, and the latter is dependent on the chemical properties of $X$ atoms. It can be concluded that, based on our results, the chemical bonding effect in $R\ensuremath{-}(\mathrm{F}\mathrm{e},\mathrm{M}{)}_{12}\ensuremath{-}X$ is determined by the features of the Fe-$X$ bonds. The role of the $X$ atom is not only to increase the magnetic moments and hyperfine fields through magnetovolume effects, but also to affect those by chemical-bonding effects. The chemical-bonding effect is strongly dependent on the $X$ atom.