They is the third-person plural personal pronoun (subjective case) in Modern English. It can also be used with singular meaning, particularly in informal contexts, sometimes to avoid specifying the gender of the person referred to.
The singular they is the use of this pronoun as a gender-neutral singular rather than as a plural pronoun. This is commonly considered to be incorrect given the fact that the singular they is mostly a colloquialism and has no basis in actual grammar rules of English. The correctness of this usage is disputed. The Oxford Dictionaries have an article on the usage, saying that it dates back to the 16th century.
The singular pronoun they is even found in formal or official texts. For example, a 2008 amendment to the Canadian Criminal Code contains the following text:
if a peace officer has reasonable grounds to believe that, because of their physical condition, a person may be incapable of providing a breath sample... (subparagraph 254(3)(a)(ii))
Which contrasts, for example, with subsecti evidence to the contrary, proof of an intent or criminal liability.
In an article published in The New York Times Magazine by Patricia T. O'Conner and Stewart Kellerman, they read:
Anne Fisher (1719-78) [an 18th-century British schoolmistress and the first woman to write an English grammar book] was not only a woman of letters but also a prosperous entrepreneur. She ran a school for young ladies and operated a printing business and a newspaper in Newcastle with her husband, Thomas Slack. In short, she was the last person you would expect to suggest that he should apply to both sexes. But apparently she couldn’t get her mind around the idea of using they as a singular.
...
Meanwhile, many great writers — Byron, Austen, Thackeray, Eliot, Dickens, Trollope and more — continued to use they and company as singulars, never mind the grammarians. In fact, so many people now use they in the old singular way that dictionaries and usage guides are taking a critical look at the prohibition against it. R. W. Burchfield, editor of The New Fowler’s Modern English Usage, has written that it’s only a matter of time before this practice becomes standard English: “The process now seems irreversible.” Merriam-Webster’s Collegiate Dictionary (11th ed.) already finds the singular they acceptable “even in literary and formal contexts,” but the Usage Panel of The American Heritage Dictionary of the English Language (4th ed.) isn’t there yet.