BRUSSELS — The world’s biggest beermaker clinched a deal Tuesday to take over its nearest rival in a bid to stave off the megabrewers’ most serious problems: the surge in popularity of craft brews and weakening sales in the rich markets of the U.S. and Europe.