Kosovo and Serbia signed an agreement which could restore ties between the two countries and pave the way for EU membership.