In this paper we introduce a new formal approach for mining biological data sets. The proposed grammar based approach provides a flexible and powerful tool for advanced sequence comparison and data mining. The approach benefits from the power of regular expressions in allowing the use of advanced queries in comparing sequences and searching fro motifs or sequence attributes in biological databases. The formal grammar and the corresponding data mining engine is capable of extracting records from biological databases, filtering a subset of those records for mining, and then sorting those records based on similarity scheme designed by the user. This model is based on the objective (ontology) of the user and scoring is dynamic that is provided at runtime.