$\ce{Mg3N2}$ is magnesium nitride. It reacts with $\ce{MeOH}$ to generate magnesium methoxide and ammonia according to online report by Buske [1].
The $\ce{NH3}$ thus generated is acting as nucleophile to react with the methyl ester to give the primary amide. It also removes two trifluoracetamide groups (or the $\ce{MeO-}$ does) to reveal the amino groups.
Quite why the authors have chosen to use this over more conventional sources of $\ce{NH3}/\ce{MeOH}$ (which is commercially available) is for them to explain.
Reference
- Gary Buske. Chemical Safety: $\ce{Mg3N2}$ Hazard. Chemical & Engineering News 2009, 87 (28).