Chords are written in this way to specify a certain bass note or voicing. Often, the bass notes will be arranged for a specific bass line. Without specifying, most would play a more common G major chord., but G/B forces the guitarist to play B as the lowest note in the chord.
In the examples below I show three slash chords. You will notice that the bass note is always a chord tone of the underlying chord as I explained above.
Now Let's look at an Dadd9/F♯, or Dadd9 over F♯.Dadd9/F♯
Now, let's look at E♭/B♭, or E♭ over B♭. E♭/B♭