A text is a triple tau = (lambda, rho1, rho2) such that lambda is a labeling function, and rho1, and rho2, are linear orders on the domain of lambda; hence tau may be seen as a word (lambda, rho1) together with an additional linear order rho2 on the domain of lambda. The order rho2 is used to give to the word (lambda, rho1) its individual hierarchical representation (syntactic structure) which may be a tree but it may be also more general than a tree. In this paper we introduce context-free grammars for texts and investigate their basic properties. Since each text has its own individual structure, the role of such a grammar should be that of a definition of a pattern common to all individual texts. This leads to the notion of a shapely context-free text grammar also investigated in this paper.