Where does the phrase “three tailed bashaw” come from and What does Bashaw mean?

In Turkey the title of bashaw or pasha is applied to military officers and civil servants of high rank, being comparable to general, admiral, or governor.

There are three grades of bashaw, and it was formerly the practice, especially during military maneuvers, to designate the grade by tying an appropriate number of horse tails to the standard of the officer, that with three tails denoting the highest rank.

Thus a three-tailed bashaw was in fact a commanding general or admiral.

The term came into English slang to describe a man of great importance, or, more often, a man who disported himself in such a way as to imply that he thought himself of great importance.