Two Syrian villages which have been besieged by rebels for three years are being emptied of their inhabitants, following a deal between the two sides.