  Groomed jet substructure measurements, the momentum splitting fraction $z_g$
and the groomed jet radius $R_g$, of inclusive, D$^0$-tagged and B$^0$-tagged
jets in $pp$ and central PbPb collisions at $\sqrt{s}=5.02$ TeV are predicted
and investigated. Charged jets are constrained in a relatively low transverse
momentum interval 15 $\leq p_{\rm T}^{\rm jet\ ch} <$ 30 GeV/$c$ where the QCD
emissions are sensitive to mass effects. In $pp$ collisions, heavy flavor jets
have less momentum-balanced splittings than inclusive jets and the larger quark
mass is, the less momentum-balanced splittings are. B$^0$-tagged jets
distribute at lager $R_g$ than both D$^0$-tagged and inclusive jets, while
D$^0$-tagged jets distribute at smaller $R_g$ than inclusive jets. That can be
explained by the competition between parton mass effects and flavour effects on
splitting-angle distributions. In $A$+$A$ collisions, jet quenching effects
further suppress the momentum-balanced splittings and enhance the large-angle
splittings. Heavy flavor jets suffer more $z_g$ and less $R_g$ modifications
due to jet-medium interactions. The mass hierarchy in $z_g$ of inclusive,
D$^0$-tagged, B$^0$-tagged jets and competition between mass effects and
Casimir colour factors in $R_g$ can also be observed in PbPb collisions.
