Halacha writes that one is supposed to say ‘Al Hanisim’ and ‘Bime Matitya’ on Chanukah in the Amidah. Halacha also writes that one should include these additions in Birkat Hamazon. The question is what if one forgot ‘Al Hanisim’ and ‘Bime Matitya’ in the Birkat Hamazon? How does he deal with it?
So the Halacha writes that he goes back to ‘Al Hanisim’ if he remembered before he said the Chatima of the Beracha of ‘Baruch Ata Hashem Al HaArtez VeAl Hamazon’.
If he said ‘Baruch Ata’ already but remembers before saying Hashem’s name, so he goes back to ‘Al Hanisim’ and ‘Bime Matitya’, and then he goes back to ‘V’Al Hakol’. However, if he remembers after saying ‘Baruch Ata Hashem’, he should then finish ‘Al Ha’Aretz VeAl Hamazon’. Now there is a Pasuk, ‘Baruch Ata Adonai Lamedani Chukecha’, which sometimes we are able to use in order to save us from the mistakes, but in this case you can not say this Pasuk, since Al Hanisim does not in any way cause you to repeat the Birkat Hamazon if you forgot it.
But the Rama (Rabbi Moses ben Israel Isserles 1525-1572) in Orach Hayim 682:1 writes, that if you forget to say ‘Al Hanisim’ and ‘Bime Matitya’ it would then be proper after finishing the HaRachamans, to say, ‘HaRachamn Hu Ya'ase Lanu Nissim Niflaot Ka’Asher Asita La’Avotenu Bayamim Hahem Bezeman Hazeh Bime Matitya Kohen Gadol’. So if you forget Al Hanisim’ and ‘Bime Matitya’ and you remember after you say ‘Baruch Ata Hashem Al HaArtez VeAl Hamazon’, you would then add this line at the end of the HaRachamans. (See Torat HaMoadim by Rabbi David Yoseph in siman 9:12.)