#If he forgot to say it and remembered
*after finishing boneh yerushalayim but before the next beracha he should insert there a beracha instead of ritze "Baruch Ata Hashem Elokenu Melech Ha'olam Asher Natan Shabbatot Le'menucha Le'amo Yisrael Be'ahava Le'ot U'berit Baruch Ata Hashem Mekadesh Ha'Shabbat."
*after beginning the fourth beracha he should just continue and not repeat. <ref> Yalkut Yosef shabbat 1 page 411. For the rules for the first two meals see http://www.dailyhalacha.com/m/halacha.aspx?id=1198. </ref>
for a women even if she remembered before starting the fourth beracha she may only say the beracha without Hashem's name or just continue onward. <ref> Yalkut Yosef shabbat 1 page 412. </ref>