One way would be to use a 3D-Texture for your terrain. Each layer of the texture is a different material (sand, rock, grass for example). Every vertex has a third uv-component that specifies the blending between two adjacent textures, you could also use the height of the vertex here. Note that a blending between grass and sand in our example is not possible with this approach because rock 'lies in between', but it is certainly the easiest and fastest method. An other method would be to use individual 2-dimensional textures instead of a single 3D one. You would then bind the textures sand and grass for example and draw all vertices that need a blending between the two. Bind two other textures and repeat. That is certainly more complicated and slower but allows blending between any two textures. There might be more methods but these two are the ones I can think off right now.
Professional game engines usually use more advanced methods, I've seen designers painting multiple materials on a terrain like in photoshop but that's a different story.