The question and the answer are in Magen Avraham OC 557.
Shulchan Aruch:
בְּתִשְׁעָה בְּאָב אוֹמֵר בְּבוֹנֵה יְרוּשָׁלַיִם: נַחֵם ה' אֱלֹהֵינוּ אֶת אֲבֵלֵי צִיּוֹן וְכו', וַעֲנֵנוּ בְּשׁוֹמֵעַ תְּפִלָּה; וְאִם לֹא אָמַר לֹא זֶה וְלֹא זֶה, אֵין מַחֲזִירִין אוֹתוֹ.
In 9 Av, in blessing Bone Yerushalayim, he says "Nachem...". In Shomea Tefila, he says "Anenu". If he did not say on of them or both, he doesn't need to repeat the prayer.
Mapa (RM Issareless)
וְהַמִּנְהָג פָּשׁוּט שֶׁאֵין אוֹמְרִים נַחֵם רַק בִּתְפִלַּת מִנְחָה שֶׁל תִּשְׁעָה בְּאָב, לְפִי שֶׁאָז הִצִּיתוּ בַּמִּקְדָּשׁ אֵשׁ וְלָכֵן מִתְפַּלְּלִים אָז עַל הַנֶּחָמָה (רוֹקֵחַ וְאַבּוּדַרְהַם). מִי שֶׁאָכַל בְּתִשְׁעָה בְּאָב, יֹאמַר נַחֵם בְּבִרְכַּת הַמָּזוֹן (מַהֲרִי''ל).
The spread custom is to say "Nachem" at Mincha only, because at this hour they started to burn the Mikdash (Rokeach and Abudarham).
Who ate on 9 Av need to say "Nachem" in Birkat Hamazon.
Magen Avraham sk 1:
בבונה ירושלים ואף שבתפלה לא נהגו לאומרו רק במנחה מ''מ בבה''מ דליכא מנהג יש לאומרו:
Despite that for prayer, there is a custom concerning the afternoon only, this restrictive custom concerns Mincha only, so, for Birkat Hamazon which has no custom, one need to say "Nachem" for every meal.