לרפואת בתי היקרה עדינה בת שבע בת נעכא גיטל בתוך שח"י
The Beis Yosef  writes in the name of the Mordechai that the third bracha of Bentching concludes בונה ברחמיו ירושלים – He builds Yerushalyim with mercy. The Kol Bo, Orchos Chaim and others write that this is not accurate because Yerushalayim will be built with JUDGMENT as the pasuk says in Yeshayahu ציון במשפט תפדה. The rejoinder is that the pasuk in Zecharya says שבתי לירושלים ברחמים ביתי יבנה בה – Yerushalayim will be built with mercy, as we say in our Bentching.
But how are we to understand the seeming contradiction in the psukim?
The Darkei Moshe explains that Tzion will be redeemed in the MERIT of judging honestly but the actual redemption of Yerushalayim will be with mercy and not with judgment.
Another possible explanation: The gemara says that the Shchina only dwelled in the first Beis Hamikdash. The Maharal says [Netzach Yisrael 4] that the first Beis Hamikdash which had the Shchina was destroyed when the Jews committed the three cardinal sins which expelled the Shchina. The 2nd Beis Hamikdash existed because the Jews were unified and was destroyed because of sinas chinam and a lack of unity.
The Medrash Yalkut at the end of sefer Melachim says that we will we only be redeemed after we do teshuva and we will only do teshuva when Eliyahu comes, as it says והשיב לב אבות על בנים. The word והשיב denotes teshuva. However, at the end of Mishnayos Eduyos it says that Eliyahu will only come to make peace between people, as it says והשיב לב אבות על בנים. So here the word והשיב is understood to mean "peace". The Rambam in his Peirush Hamishnayos explains that the peace will be removing the barriers between people.
Based on the foregoing, explained the Rinas Yitzchak [Yeshayahu p. 12] that the teshuva will be to bring peace between people, so the Mishna in Eduyos and the Medrash in Melachim are saying the same thing.
It emerges that in fact Yerushalayim will be built במשפט – according to strict deserved judgment, because we will have fixed the sin of sinas chinam and peace among us will reign. However, the SHCHINA will not return in judgment because we did nothing to merit its return and will thus only be restored out of Hashem's mercy.
ציון במשפט תיפדה – The actual building of the Beis Hamikdash will be in accordance with the standards of strict judgment.
שבתי לירושלים ברחמים – The Shechina will return in mercy, for that we don't deserve.
An interesting note: In Shmoneh Esrei we say ולירושלים עירך ברחמים תשוב and ותחזינה עינינו בשובך לציון ברחמים - as we say in Bentching [and unlike the opinion of the Kol Bo and Orchos Chaim].