Sexing Knight Gobies

The male's second dorsal will generally extend all the way to the tail, where the female's is quite a bit shorter. Also, in a mixed display, the males will darken in color to show off to the females.
 
AquariaCentral.com