At the simplest level it’s really just the lawyers who operate in the court (barristers) versus those who operate outwith it (solicitors). It’s a bit more complex and couched in tradition but that’s the gist of it. It’s actually from the same etymology as the “Bar” in the US, as in “admission to the bar” or “the bar association”. It represents a person who has “passed the bar” in the courtroom, separating spectators from participants. It’s just that the setup is a little different, with most solicitors not having a right of audience in the court.
Another difference in Scots law - no barristers but “advocates” instead.