Abstract We present a relative trace formula approach to the Gross–Zagier formula and its generalization to higher-dimensional unitary Shimura vari- eties. As a crucial ingredient, we formulate a conjectural arithmetic funda- mental lemma for unitary Rapoport–Zink spaces. We prove the conjecture when the Rapoport–Zink space is associated to a unitary group in two or three variables.