Often, they are determined by the implementation of a resource itself.
Applications MUST NOT directly specify the syntax of queries, as this can cause operational difficulties for deployments that do not support a particular form of a query.
For example, a site may wish to support an application using "static" files that do not support query parameters.
Extensions MUST NOT constrain the format or semantics of queries.
For example, an extension that indicates that all query parameters with the name "sig" indicate a cryptographic signature would collide with potentially preexisting query parameters on sites and lead clients to assume that any matching query parameter is a signature.
HTML W3C.REC-html401-19991224 constrains the syntax of query strings used in form submission. New form languages SHOULD NOT emulate it, but instead allow creation of a broader variety of URIs (e.g., by allowing the form to create new path components, and so forth).
Note that "well-known" URIs (see RFC 5785) MAY constrain their own query syntax, since these name spaces are effectively delegated to the registering party.