Thanks for your inputs.
By Grammar I mean the the Language and Grammar which is generally used to generate parsers. When a users fires a search request to the Zimbra Server it contains an element <query> which contains the query user has fired. This query is parsed on the Zimbra Server side by a parser which is generated by Java CC (A Parser generation tool in java) found at https://javacc.dev.java.net/
This tool needs a Language and Grammar to generate a parser as it is with other classical tools like Yacc (mostly used with lex-another tool).
To be specific I would like to know the Grammar for query element in following code
Above mentioned search criteria is just an example and there are other various complex scenario's possible for the search criteria in <query></query> node.
offset="0" limit="25" types="message,contact,appointment,wiki,document"><tz id="(GMT+05.30) Chennai
/ Kolkata / Mumbai / New Delhi"/><locale>en-US</locale>
<query>((from:(swapnil)) OR (from:(ajay))) in:inbox larger:2kb</query>