Is it possible to use comments in QGIS Query Builder with ESRI shapefiles?
It doesn't work with ESRI shapefile. However, commenting in expressions works in QGIS 2.14 with SpatiaLite, SQlite and GeoPackage. For most other formats available in the
Save as...-dialog, the query fails with an OGR-error.
-- for one-line comments
/* ... */ for multi-line comments
It turns the letters to a green color in the expression builder window and they seem indeed to be commented out!
You can build queries by using the Query Builder or an alternative is to use the Expression string builder (Layer Properties > Style > select Rule-based > add a rule > insert your command in the Filter box or click the '...' button to bring up the string builder interface.
In both cases, I do not think QGIS supports the comments function when creating expressions for filters/queries: