This paper introduces a grammar-based pre-processing method for the Prediction by Partial Matching (PPM) compression algorithm, leading to better compression rates across various natural languages. By generating grammar from common bigraphs or trigraphs in the text, the method replaces these sequences with non-terminal symbols, enhancing compression effectiveness. Experimental results show significant improvement in compression rates, particularly for languages like Chinese and Welsh, when compared to existing algorithms.