Play D7 the one at fret 2 then add on note F on the D string. This is a dimished chord, guess its F#Diminshed. Neat thing about these images they repeat every 3 frets so this repeats at fret 5, ie it is the same chord again.
Now the inner strings also have different fingerings, but are a little more difficult to explain. In the older sense of 'modulated' one can fiddle with the C Mediant Modulated Chord at fret 3 and make a Diminished chord. If I remember correctly - no guitar here - one adds one new note and sharpens another.
Like all 'passage' chords there are many alternatives - you can often use a 7th instead of a diminshed for example.