Not much to add to Dave's and Gershon's excellent explanations, except to add that it's an honorific given to other prominent people too. For example, the Noda Biyehudah (R' Yechezkel Landau) uses it in the salutation of a responsum to Chacham Yitzchak Bachar David of Constantinople.