This is an English expression meaning “mind your language” or “be on your best behavior.” The equivalent in America would be “on your toes.”
Ps and Qs are simply the plurals of the letters P and Q. There are different ways of spelling these — either upper-case or lower-case and either with or without an apostrophe. I’ve picked “Ps and Qs” as being the most logical.
There are plenty of theories as to the origin of the phrase — some fanciful and some more or less plausible. It’s also uncertain when the phrase began to be used, but there is a citation from Thomas Dekker’s play, The Untrussing of the Humorous Poet, 1602, which appears to be the earliest use of the expression.
Theory 1: Mind your pints and quarts. This popular suggestion comes from the practice of chalking up (on the slate) a tally of drinks in English pubs. Publicans had to make sure to mark up quart drinks separately from pint drinks. An offshoot of this is the idea that the publican would yell, “Mind your Ps and Qs,” when the patrons became rowdy. However, at the time the saying became part of the English lexicon, beer wasn’t sold in pubs by the pint or quart. Instead, it was drawn from kegs, and patrons were charged by the glass or tankard. That eliminates the theory of chalking Ps and Qs on a slate, and also renders the idea of the publican shouting “Mind your Ps and Qs” as highly unlikely.
Theory 2: A phrase used to teach printers’ apprentices not to confuse the backward-facing metal type lowercase Ps and Qs, or to instruct children learning to write. Nobody ever says “mind your Ds and Bs” though that makes just as much sense. However, handmade paper was expensive and the setting of type in early presses was very time consuming, so the printing story is a strong candidate. The fact that type had to be set upside down and backwards made the need for a warning to be careful doubly appropriate.
Theory 3: Mind your pea (jacket) and queue (wig). Pea jackets were short woollen overcoats, commonly worn by sailors in the 18th century. In days when seamen styled their hair into long pigtails dipped in tar, the phrase was a prompt to not let their tarred hair (queues) soil their navy pea-jackets (peas).
“Pee,” as a name for a man’s coarse coat, is recorded as early as 1485. “Kue” or “cue” as the name of a man’s wig isn’t known until well after 1602, though.
Theory 4: A second version of the “instruction to children” origin says that “Ps and Qs” derives from “mind your pleases and thank-yous.” This is also a popular theory but seems too far-fetched to me.
Theory 5: Throughout the saying’s various appearances across the centuries, twin themes of quality and good behavior emerge, which perhaps accounts for the current English definition of “mind your manners.” The phrase could have, over time, evolved from a statement about the sterling nature of a physical item (such as a pint or quart of beer) to a statement about desirable behavior traits.
There are five theories — take your pick!