creating a system similar to bejeweled with boxes

I'm laying out some pseudo-code for a game and I'm trying to figure out how to set a system where 3 blocks or more of the same color clear. The way I'm thinking is that I'll constantly check to see if the is an object on either side of the x y and z coordinates for each box. This will be happening every frame and it doesnt seem to be very efficient. there has to be a smarter way of doing this. any ideas?

Yes. You could store references to each object in a hash, then have each cube check its neighbors. I implemented a system something like this where each cube had to know its neighbors. I made the key to the hash be my Vector3 (as a string), then stored the cube type in the hash. You'd do something like this:

using UnityEngine;
using System.Collections;

public class CheckNeighbors : MonoBehaviour {

    public Hashtable cubes;

    void Start() {
        cubes = new Hashtable();
        cubes.Add("(0,1,0)", "red");
    }

    void Update() {

        Vector3 aboveCube = new Vector3(transform.position.x, transform.position.y+1, transform.position.z)

        if (h.ContainsKey(aboveCube.ToString())) {
            if(h.[aboveCube.ToString()] == "red") 
                Debug.Log("There is a red cube above you!");
        }

    }
}

You'd have to have your cubes constrained to a grid for this to work and have the project be in 3D. If you need it for a 2D project, all you'd do is change the Vector3 declaration to a Vector2 declaration. Also, if you need it in JavaScript (UnityScript), let me know.

Also, please note that to all intents and purposes, this is simply syntactically correct psuedocode. It is not designed to work correctly, but rather to give you an idea of how to use the theory.

This code is untested C#, please note any errors.