Armenia has agreed to return several villages to Azerbaijan in what both countries say is an important milestone as they edge towards a peace deal after fighting two wars since the collapse of the Soviet Union.