Valeyard

Valeyard was a title, potentially Gallifreyan in origin, which the Sixth Doctor knew to mean "learned court prosecutor". (TV: The Mysterious Planet) According to the Inquisitor, it meant "doctor of law". (PROSE: The Inquisitor)

Before his escape from Gallifrey, the First Doctor told Patience that he would take their grandchild "far from this world of vampires and valeyards". (PROSE: Cold Fusion)

In the Sixth Doctor's trial, the title was claimed by a Time Lord known as the Valeyard, who revealed to be an amalgamation of the Doctor's darker sides, taken from a point in the Doctor's personal future. (TV: The Ultimate Foe)

During his trial, the Doctor was observed to apply various words ending in "yard" to mock and insult the Valeyard, including backyard, brickyard, farmyard, graveyard, knacker's yard, railyard, scrapyard and stackyard. (TV: The Mysterious Planet, Mindwarp, Terror of the Vervoids, The Ultimate Foe)

Behind the scenes
Contrary to the in-universe definition and despite what Shannon Sullivan's A Brief History Of Time claims, "Valeyard" is not a genuine legal title meaning "learned court prosecutor" or an obsolete phrasing of "doctor of law." The term was entirely made-up during production - as evidenced by the character outline as delivered on 5 July 1985 and was devised by either John Nathan-Turner or Eric Saward. The term is originally briefly spelled in this documentation as "Valiyard", but this was amended that same day.