Well it depends on your project.
So I strongly invite you to either post your project as it stands, or search for existing references to level editors in the forums or in the tutorials.
What is the size of your grid ?
If your project is made on a 64 pixels basis (GridWidth and GridHeight and you want to place your blocks thanks to the mouse input, then what you do is that when you click to place the block, you position/create it at the
x position : int(Mouse.X / GridWidth) * GridWidth + GridWidth/2
y position: int(Mouse.Y / GridHeight) * GridHeight + GridHeight/2
Example capx made in r208