Can I modify grass or details on the terrain at runtime?

Can i have opportunity to remove a type of grasslayer via scrpt? for example when my cube collide on a selected type of grass,the grass die.Is it possible?

You can use these (undocumented) commands to read and write the terrain detail layers:

// read all detail layers into a 3D int array:
int numDetails = terrainData.detailPrototypes.Length;
int [,,] detailMapData = new int[terrainData.detailWidth, terrainData.detailHeight, numDetails];
for (int layerNum=0; layerNum < numDetails; layerNum++) {
    int[,] detailLayer = terrainData.GetDetailLayer(int x, int y, int width, int height, int layerNum);
}

// write all detail data to terrain data:
for (int n = 0; n < detailMapData.Length; n++)
{
    terrainData.SetDetailLayer(0, 0, n, detailMapData[n]);
}

So, using the above scripts, you would read the layers, edit the values in the array relating to the details at a particular area, and then write the details back to the terrainData.

Because these functions are undocumented, any future updates of the unity engine might change or remove these functions from the API. This means your project may not work in future versions of the Unity editor, and webplayer builds may not work with future versions of the plugin.

I assume you are talking about grass on the built-in terrains in Unity.

You can modify the terrain at runtime. See this Q&A:

http://answers.unity3d.com/questions/2224/just-how-malleable-are-terrains-really

You can use that functionality to alter where the grass is on a terrain.