You have a scoping issue here. The Grid class you defined is in the Assets namespace. Notice the reference count above it indicates it is not referenced anywhere.
The Grid class you're referencing in MainBehaivior is not the same type. Just guessing but it is likely defined in UnityEngine. You can select the type in the file and press F12 to go to its definition.
To fix this change the name of your Grid class. I would recommend something that clarifies it is deriving from MonoBehaviour like GridBehaviour. You should then see your MainBehaivior still sees Grid as valid, but not your type. Change this declaration to use GridBehaviour. If, after this change, you get an error about it not being defined then quick action the error and it should opt to add a using for the correct namespace.