I'm going to play devil's advocate and ask, "Is this legal?" To ban a company from your city just because of its owners views? Granted I don't know if the owner has performed actions against ssm, and if he has, then sure, ban him. But I can't see banning him just for his views.
Boston cannot ban CFA from the city, but that is not what the mayor is doing. He is trying to keep them out of a certain district of the city.
Government restrictions on speech are subject to a "time-place-manner" test and restrictions must be content-neutral. If there is no time/place/manner in which you can act, this is a violation of the First Amendment. Governments can, however, ban speech in certain times/locations/manners. (i.e. "you cannot protest with any noise within 30 feet of the courthouse." Under that ordinance, you could protest vocally 31 feet from the courthouse, or you could protest 5 feet from the courthouse if you did so silently.) Government restrictions on speech must also be content-neutral. (i.e. "No political campaigning within 100 feet of a polling place." This is valid since it limits ALL political campaigning, and gives a location where such campaigning could be done. Contrast "No anti-war protests within 100 feet of a polling place.")
Boston keeping CFA out of a certain district is perfectly valid under time/space/manner, since there are other places they could go. I am not sure about the content-neutral restriction. Saying "CFA cannot set up a store here because they are anti-gay" would not be content neutral, especially if other fast-food places were allowed in that district.
(There are ways governments can restrict corporate speech. I need to look up those limits since I cannot remember them. That may have an impact on how constitutional Boston's actions would be.)