Kramdown (Jekyll’s default Markdown processor) has inline attribute lists that you can use to add classes and id’s to an element.
For example you could do this to add class="galleryThumb"
to your image.
![image]({{ site.baseurl }}/images/category/thumb/image-1-th.jpg){: .galleryThumb}
I’ve never tried doing it with an anchor wrapping an image, but the following should work:
[![image]({{ site.baseurl }}/images/category/thumb/image-1-th.jpg){: .galleryThumb}]({{ site.baseurl }}/images/category/image-1.jpg){: #galleryImage}
Though I don’t know if it’s any better or easier to read than straight HTML.