The grandchildren of the creator of Thomas the Tank Engine have won a bitter tax battle against HMRC over the multi-million-pound royalties of the series.