SABMiller is to regain the rights for its Miller brands in Canada after settling a long-running legal dispute with Molson Coors.