The Mishnah Berurah brings the custom to say על נהרות בבל during the week, before
saying bircas hamazon, as a reminder to mourn over the destruction of the Bais HaMikdash.
On Shabbos and Yom tov when mourning is prohibited, one should say שיר המעלות. However,
people are lenient on saying על נהרות בבל, because we don’t feel the pain of the Churban, so
mourning is difficult for us. On Shabbos that we are not mourning rather expressing our
yearning for Tzion in the שיר המעלות, it has become more popular to be said. On Erev Shabbos
after chatzos, Rosh Chodesh or other occasions when tachanum is not recited, one should say
שיר המעלות.