The BBC licence fee will increase in line with inflation each year until 2027, the government has announced.